// 应用全局状态管理
import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useAppStore = defineStore('app', () => {
  const loading = ref(false)
  const sidebarCollapsed = ref(false)
  const currentAgent = ref<'home' | 'forest' | 'pest' | 'fire'>('home')

  // 设置全局加载状态
  const setLoading = (status: boolean) => {
    loading.value = status
  }

  // 切换侧边栏
  const toggleSidebar = () => {
    sidebarCollapsed.value = !sidebarCollapsed.value
  }

  // 设置当前智能体
  const setCurrentAgent = (agent: 'home' | 'forest' | 'pest' | 'fire') => {
    currentAgent.value = agent
  }

  return {
    loading,
    sidebarCollapsed,
    currentAgent,
    setLoading,
    toggleSidebar,
    setCurrentAgent
  }
})
